<%--
  Created by IntelliJ IDEA.
  User: kkk
  Date: 2022/11/21
  Time: 16:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="${pageContext.request.contextPath}/statics/layui/layui.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/statics/layui/css/layui.css">
    <link rel="shortcut icon" href="${pageContext.request.contextPath}/statics/images/ico/favicon.ico">
    <script src="${pageContext.request.contextPath}/statics/js/jquery-3.4.1.min.js"></script>
</head>>
<body class="gray-bg">
<form class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">编号</label>
        <div class="layui-input-block">
            <input type="text" name="id" value="${sysUser.id}" readonly lay-verify="title" autocomplete="off"  class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">账号</label>
        <div class="layui-input-block">
            <input type="text" name="account" value="${sysUser.account}" lay-verify="title" autocomplete="off"  class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">真实姓名</label>
        <div class="layui-input-block">
            <input type="text" name="realName" lay-verify="title" autocomplete="off" value="${sysUser.realName}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="text" name="password" lay-verify="title" autocomplete="off" value="${sysUser.password}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="1" title="女" ${sysUser.sex==1?"checked":""}>
            <input type="radio" name="sex" value="2" title="男" ${sysUser.sex==2?"checked":""}>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">出生日期</label>
        <div class="layui-input-block">
            <input type="text" name="birthday" lay-verify="title" autocomplete="off" value="<fmt:formatDate value="${sysUser.birthday}" pattern="yyyy-MM-dd" />" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话</label>
        <div class="layui-input-block">
            <input type="text" name="phone" lay-verify="title" autocomplete="off" value="${sysUser.phone}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">地址</label>
        <div class="layui-input-block">
            <input type="text" name="address" lay-verify="title" autocomplete="off" value="${sysUser.address}" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">角色</label>
        <div class="layui-input-block">
            <select name="roleId" lay-filter="aihao">
                <option value="1" ${sysUser.roleId==1? "selected":""}>管理系统员</option>
                <option value="2" ${sysUser.roleId==2? "selected":""}>店长</option>
                <option value="3" ${sysUser.roleId==3? "selected":""}>店员</option>
            </select>
        </div>
    </div>
<%--    <div class="layui-form-item">--%>
<%--        <label class="layui-form-label">证件照</label>--%>
<%--        <div class="layui-input-block">--%>
<%--            <input type="file" name="idpicpath" lay-verify="title" autocomplete="off" value="${sysUser.idpicpath}" class="layui-input">--%>
<%--        </div>--%>
<%--    </div>--%>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script>
    layui.use(['form','jquery'], function(){
        var form = layui.form;
        var $ = layui.jquery;
        form.on('submit(demo1)',function (data) {
            $.get("${pageContext.request.contextPath}/sysUser/edit",data.field,function (data) {
                if (data==="1"){
                    alert("修改成功");
                    location.href="${pageContext.request.contextPath}/sysUser/toList";
                }else {
                    alert("修改失败");
                    location.href="${pageContext.request.contextPath}/sysUser/toList";
                }
            })
        })
    })
</script>
</body>
</html>
